import { locations } from "../../../gpu/locations";
const SkyboxGeometry =/*wgsl*/`
#include <Camera>
struct VertexInput {
  @builtin(instance_index) index : u32,
  #if ~{def.position}
  @location(${locations.position[1]}) position : vec3<f32>,
  #endif
}
struct VertexOutput {
  @builtin(position) Position : vec4<f32>,
  @location(0) localPos:vec3<f32>,
}
#if ~{def.trans}
@group(${locations.trans[0]}) @binding(${locations.trans[1]}) var<uniform> model : mat4x4<f32>;
#endif
@vertex
    fn main(vertexInput:VertexInput) -> VertexOutput {
      var output:VertexOutput;
      var rotateX=mat3x3f(vec3f(1, 0, 0 ),vec3f(0, 0, -1 ),vec3f( 0, 1, 0 ));
      output.localPos = rotateX*vertexInput.position;
      // output.localPos = vertexInput.position;
      var p=camera.project;
      p[2].z = 1.0 ;
      p[3].z = -1.0 ;
      var rotView:mat4x4<f32> =camera.view;
      rotView[3][0]=0.0;
      rotView[3][1]=0.0;
      rotView[3][2]=0.0;
      // rotView[3][3]=0.001;
      var clipPos = p * rotView * model*vec4(vertexInput.position, 1.0);
      output.Position =vec4<f32>(clipPos.x,clipPos.y,clipPos.w, clipPos.w);
      return output;
    }
`
export { SkyboxGeometry }